<?php
/**
 * Description: 查询用户是否存在密码
 * User: devforma
 * Date: 15/7/9
 * Time: 17:55
 */

class UserHasPassword implements iController {

    /**
     * api请求处理主函数
     * @param array $queryArgs 就是$_REQUEST变量
     * @return array api返回结果，必须含response_code
     */
    public function output($queryArgs) {
        global $uddb;

        if (validateUser($queryArgs) !== 1)
            return genOutput(1000);

        $pwd = $uddb->getVar('SELECT `user_pass` FROM `user_auth_info` WHERE `ID`=:uid',
            array(':uid' => $queryArgs['user_id']));

        return genOutput(1, array(
            'has_password' => !empty($pwd)
        ));

    }
}